package com.example.data.factory.web1.controller;

import com.example.data.factory.common.Dto.*;
import com.example.data.factory.common.result.R;
import com.example.data.factory.entity.entity.DataAssetInfo;
import com.example.data.factory.service.service.DataAssetInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 数据资产表信息 前端控制器
 * </p>
 *
 * @author lhy
 * @since 2025-03-03
 */
@RestController
@RequestMapping("/dataAssetInfo")
public class DataAssetInfoController {
    @Resource
    private DataAssetInfoService dataAssetInfoService;

    @GetMapping("/SearchDataAssetInfo")
    public R<DataAssetInfo> SearchDataAssetInfo(SearchDataAssetInfoDto searchDataAssetInfoDto) {
        return dataAssetInfoService.search ( searchDataAssetInfoDto );
    }

    @PostMapping("/InsertDataAssetAndField")
    public R<DataAssetInfo> InsertDataAssetAndField(@RequestBody InsertDataAssetInfoDro insertDataAssetInfoDro, HttpServletRequest request) {
        return dataAssetInfoService.inserts ( insertDataAssetInfoDro, request );
    }

    @PutMapping("/UpdateDataAssetAndField")
    public R<DataAssetInfo> UpdateDataAssetAndField(@RequestBody UpdateDataAssetInfoDto updateDataAssetInfoDto) {
        return dataAssetInfoService.updates ( updateDataAssetInfoDto );
    }

    @PutMapping("/UpdateAssetInfoStatus")
    public R<DataAssetInfo> UpdateAssetInfoStatus(@RequestBody UpdateDataAssetInfoStatusDto updateDataAssetInfoStatusDto) {
        return dataAssetInfoService.updatestatus ( updateDataAssetInfoStatusDto );
    }

    @DeleteMapping("/DeleteDataAssetInfo")
    public R<DataAssetInfo> DeleteDataAssetInfo(DeleteDataAssetInfoDto deleteDataAssetInfoDto) {
        return dataAssetInfoService.delete ( deleteDataAssetInfoDto );
    }

    @PutMapping("/UpdateDataAssetInfoStatusBash")
    public R<DataAssetInfo> UpdateDataAssetInfoStatusBash(@RequestBody List<UpdateDataAssetInfoStatusDto> updateDataAssetInfoStatusDtos) {
        return dataAssetInfoService.updatestatusbash ( updateDataAssetInfoStatusDtos );
    }

    @GetMapping("SearchDataAssetInfoDetail")
    public R<DataAssetInfo> SearchDataAssetInfoDetail(SearchDataAssetInfoDetailDto searchDataAssetInfoDetailDto) {
        return dataAssetInfoService.searchdetail ( searchDataAssetInfoDetailDto );
    }

}

